project(ping_service)

# PingService库（业务逻辑）
set(HEADERS 
    ping_service.h
)
set(SRCS 
    ping_service.cpp
)
add_library(${PROJECT_NAME} STATIC ${HEADERS} ${SRCS})

target_link_libraries(${PROJECT_NAME} 
    framework 
    nlohmann_json::nlohmann_json
)

target_include_directories(${PROJECT_NAME} PRIVATE 
    ${CMAKE_SOURCE_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}
)

# ========================================
# 新增：PingService独立进程可执行文件
# ========================================
add_executable(ping_service_process
    main.cpp
)

target_link_libraries(ping_service_process
    PRIVATE
        ${PROJECT_NAME}
        service_server
        service_registry
        database
        logger
        service_rpc_proto
        gRPC::grpc++
        protobuf::libprotobuf
)

target_include_directories(ping_service_process PRIVATE
    ${CMAKE_SOURCE_DIR}
)

# 设置输出名称
set_target_properties(ping_service_process PROPERTIES
    OUTPUT_NAME "ping_service"
)

# 安装
install(TARGETS ping_service_process
    RUNTIME DESTINATION bin
)